<%-- 
    Document   : ThemDanhMucContent
    Created on : Oct 18, 2011, 11:55:52 PM
    Author     : kijoo
--%>

<%@page import="MODEL.POJO.LoaiDanhMucPOJO"%>
<%@page import="MODEL.POJO.LoaiSanPhamPOJO"%>
<%@page import="MODEL.DAO.LoaiSanPhamDAO"%>
<%@page import="MODEL.DAO.LoaiDanhMucDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<style type="text/css">
    <!--
    .style1 {color: #000000}
    -->
</style>
<script type="text/javascript" src="js/combobox.js"></script>
<div class="tieude">Thêm danh mục</div>    
<div align="center">
    <p>&nbsp;</p>
    <table width="550" height="148" align="center"> 
        <form onSubmit="return kiemtra()" action="ThemDanhMucController" method="get" name="form1" id="them">
            <tr>
            <td height="26"><label><span style="color: #000000">Chọn loại sản phẩm</span></label></td>
            <td width="50%" align="left">

                <select name="loaiSP" id="loaiSP" onChange="getLoaiSPDropdown()">
                    <option value="-1" selected="selected">Chọn loại sản phẩm...</option>
                    <%
                        ArrayList<LoaiSanPhamPOJO> ds = LoaiSanPhamDAO.LayDanhSachLoaiSanPham();
                        for (int i = 0; i < ds.size(); i++) {
                            LoaiSanPhamPOJO lsp = ds.get(i);


                    %>
                    <option value="<%= lsp.getIdloaisanpham()%>" ><%= lsp.getTenloaisanpham()%></option>

                    <% }%>
                </select></td>
            </tr>


            <tr>
            <td height="21"><label><span style="color: #000000">Chọn loại danh mục</span></label></td>
            <td><div id="idloaidm"> </div></td>

            </tr>



            <tr>
            <td height="25"><label><span style="color: #000000">Mã danh mục</span></label></td>
            <td><label for="maDM"></label>
            <input type="text" name="maDM" id="maDM" size="50"
                   <%
                       if (request.getParameter("maDM") != null) {
                   %>
                   value="<%=request.getParameter("maDM")%>"
                   <%}%>                       />            </td>
            </tr>
            <tr>
            <td height="24"><label><span style="color: #000000">Tên danh mục</span></label></td>
            <td><label for="tenDM"></label>
            <input type="text" name="tenDM" id="tenDM" size="50"

                   <%
                       if (request.getParameter("tenDM") != null) {
                   %>
                   value="<%=request.getParameter("tenDM")%>"
                   <%}%>                       />            </td>
            </tr>


            <tr>
            <td colspan="2"><div align="center">
                    <input type="submit" name="btThem" id="btThem" value="Thêm" style="background-color:#FFFF66">

                </div></td>
            </tr>

        </form>
  </table>
</div>
<script language="JavaScript">
    function kiemtra()
    {
        form1=document.getElementById("them");
        if(form1.loaiSP.value=="-1")
        {
            alert("Chưa chọn loại sản phẩm"); form1.loaiSP.focus(); return false; 
        }
        if(form1.maDM.value=="")
        {
            alert("Chưa nhập mã danh mục"); form1.maDM.focus(); return false; 
        }
        if(form1.tenDM.value=="")
        {
            alert("Chưa nhập tên danh mục"); form1.tenDM.focus(); return false; 
        }
        return true;
    }
</script> 

